import { apiRequestPost, apiRequestExport } from '../globalApi.js'
import LocalCache from '@/utils/cache'
const userData = LocalCache.getCache('user')
const userId = userData.userId
/**
 * 查询所有流程    
 */
export const apiQueryAllProcesses =(params)=>{
    return  apiRequestPost('/bpm-service/BpmProcessDef/queryAllProcesses', params)
}
/**
 * 查询用户列表
 */
export const apiQueryUser =(params)=>{
    return  apiRequestPost('/bpm-service/BpmUser/queryUser', params)
}
/**
 * 按委托类型查询委托人角色部门
 * userId  默认查询全部
 */
export const apiQueryDelegate =(params={userId:userId})=>{
    return  apiRequestPost('/bpm-service/BpmUser/queryDelegate', params)
}
/**
 * 按委托类型查询受理人角色部门
 * userId
 */
export const apiQueryAccept =(params={userId:userId})=>{
    return  apiRequestPost('/bpm-service/BpmUser/queryAccept', params)
}
/**
 * 查询流程任务节点
 */
export const apiQueryTask =(params)=>{
    return  apiRequestPost('/bpm-service/ProcInst/queryTask', params)
}
/**
 * 查询用户部门
 */
export const apiQueryDept =(params)=>{
    return  apiRequestPost('/bpm-service/BpmUser/queryDept', params)
}

/**
 * 应用系统查询
 */
export const apiQueryApp =(params)=>{
    return  apiRequestPost('/bpm-service/AppCfg/queryApp', params)
}

// 按流程实例授权列表

export const apiQueryNodeCode =(params)=>{
    return  apiRequestPost('/bpm-service/ProcAuthInst/queryNodeCode', params)
}

// 查询流程实例的权限

export const apiQueryAuth =(params)=>{
    return  apiRequestPost('/bpm-service/ProcAuthInst/queryAuth', params)
}

// 图形监控

export const apiGetProcessInfoById =(params)=>{
    return  apiRequestPost('/bpm-service/ProcAuthInst/getProcessInfoById', params)
}
// 删除流程实例授权

export const apiDeleteAuth =(params)=>{
    return  apiRequestPost('/bpm-service/ProcAuthInst/deleteAuth', params)
}
// 按查询条件授权/选择记录授权

export const apiProcAuthInstAuth =(params)=>{
    return  apiRequestPost('/bpm-service/ProcAuthInst/auth', params)
}

//流程配置管理

//表单配置删除
export const apiFormCfgDeleteForm =(params)=>{
    return  apiRequestPost('/bpm-service/FormCfg/deleteForm', params)
}

//表单配置查询
export const apiFormCfgQueryForm =(params)=>{
    return  apiRequestPost('/bpm-service/FormCfg/queryForm', params)
}

//表单配置保存
export const apiFormCfgSaveForm =(params)=>{
    return  apiRequestPost('/bpm-service/FormCfg/saveForm', params)
}
/**
 * 领取任务    
 */
export const apiClaimTask =(params)=>{
    return  apiRequestPost('/bpm-service/BpmApi/claimTask', params)
}
/**
 * 批量领取任务  
 * claimerId: 任务人id(用户id)
 * List  任务IDs
 */
export const apiClaimTasksBulk =(params)=>{
    return  apiRequestPost('/bpm-service/BpmApi/claimTasks', params)
}
/**
 * 批量委托  
 * 委托操作用户ID operatorId
 * 委托操作用户名称 operatorName
 * 接收用户ID acceptorId
 * 接收用户名称 acceptorName
 * 委托任务ID列表 list
 */
export const apiReassignTasksBulk =(params)=>{
    return  apiRequestPost('/bpm-service/BpmApi/reassignTasks', params)
}

//我的工作导出
export const apiMyUndoTaskExport =(params)=>{
    return  apiRequestExport('/bpm-service/MyUndoTask/export', params)
}
//已办工作导出
export const apiMyDoneTaskExport =(params)=>{
    return  apiRequestExport('/bpm-service/MyDoneTask/export', params)
}
//我的关心的工作导出
export const apiMyFavorTaskExport =(params)=>{
    return  apiRequestExport('/bpm-service/MyFavorTask/export', params)
}
//被代理的工作导出
export const apiMyDelegatedTaskExport =(params)=>{
    return  apiRequestExport('/bpm-service/MyDelegatedTask/export', params)
}
//我的参与的流程导出
export const apiMyInvolveTaskExport =(params)=>{
    return  apiRequestExport('/bpm-service/MyInvolveTask/export', params)
}
//查询当前经办岗
export const apiQueryRoles =(params)=>{
    return  apiRequestPost('/bpm-service/BpmUser/queryRoles', params)
}